package dao.Impl;

import dao.TclassifyDao;
import pojo.Tclassify;
import util.BaseDao;

import java.util.ArrayList;
import java.util.List;

public class TclassifyDaoImpl extends BaseDao implements TclassifyDao {

    @Override
    public List<Tclassify> seltclassify(int id) {
        String sql = "select * from t_classify where parent_id=?";
        rs = exeQ(sql, id);
        List<Tclassify> list = new ArrayList<>();
        Tclassify ts = null;
        try {
            while (rs.next()) {
                ts = new Tclassify(rs.getInt(1), rs.getString(2),
                        rs.getInt(3), rs.getInt(4), rs.getString(5));
                list.add(ts);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            closeAll();
        }

        return list;
    }
}
